<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('退款申请列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>用户Id：</label>
                                <input type="text" name="userId"/>
                            </li>
                            <li>
                                <label>订单明细Id：</label>
                                <input type="text" name="orderItemId"/>
                            </li>
                            <li>
                                <label>订单Id：</label>
                                <input type="text" name="orderId"/>
                            </li>
                            <li>
                                <label>退款类型：</label>
                                <select name="type">
                                    <option value="">所有</option>
                                    <option value="1">收到商品破损</option>
                                    <option value="2">商品错发、漏发</option>
                                    <option value="3">收到商品与描述不符</option>
                                    <option value="4">其他</option>
                                </select>
                            </li>
                            <li>
                                <label>审核状态：</label>
                                <select name="auditStatus">
                                    <option value="">所有</option>
                                    <option value="1">同意</option>
                                    <option value="2">拒绝</option>
                                </select>
                            </li>
                            <li>
                                <label>审核时间：</label>
                                <input type="text" class="time-input" placeholder="请选择审核时间" name="auditTime"/>
                            </li>
                            <li>
                                <label>创建时间：</label>
                                <input type="text" class="time-input" placeholder="请选择创建时间" name="createTime"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="refund:apply:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="refund:apply:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('refund:apply:edit')}]];
        var removeFlag = [[${@permission.hasPermi('refund:apply:remove')}]];
        var prefix = ctx + "refund/apply";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "退款申请",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '退款申请id',
                    visible: false
                },
                {
                    field: 'userId',
                    title: '用户Id'
                },
                {
                    field: 'orderItemId',
                    title: '订单明细Id'
                },
                {
                    field: 'orderId',
                    title: '订单Id'
                },
                {
                    field: 'type',
                    title: '退款类型',
                    formatter: function(value, row, index) {
                        if(1 == value){
                            return "收到商品破损";
                        } else if (2 == value) {
                            return "商品错发、漏发"
                        } else if (3 == value) {
                            return "收到商品与描述不符"
                        }else if (4 == value) {
                            return "其他"
                        }
                    }
                },
                {
                    field: 'reason',
                    title: '退款原因'
                },
                {
                    field: 'imgUrl',
                    title: '图片'
                },
                {
                    field: 'auditStatus',
                    title: '审核状态：',
                    formatter: function(value, row, index) {
                        if(1 == value){
                            return "同意";
                        } else if(2 == value){
                            return "拒绝";
                        }
                    }
                },
                {
                    field: 'auditReason',
                    title: '审核说明'
                },
                {
                    field: 'auditBy',
                    title: '审核者'
                },
                {
                    field: 'auditTime',
                    title: '审核时间'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>